/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.converter;

import br.com.deployment.entidade.selo.TipoSelo;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

/**
 *
 * @author roniere
 */
@FacesConverter(value="tipoSeloConverter")
public class TipoSeloConverter implements Converter{

    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        TipoSelo tipoSelo = new TipoSelo();
        tipoSelo.setId(Integer.valueOf(value));  
        return tipoSelo;
    }

    @Override
    public String getAsString(FacesContext context, UIComponent component, Object value) {
        TipoSelo tipoSelo = (TipoSelo) value;
        return "" + tipoSelo.getId();
    }
    
}
